package com.liangzhong.model.winebar
{
	import com.liangzhong.errortip.ErrorTips;
	import com.liangzhong.model.AppData;
	import com.liangzhong.model.winebar.vo.WineBarInfoVo;
	
	import flash.utils.ByteArray;
	
	import lz.controls.Alert;

	/**
	 *酒吧服务器数据返回解析  
	 * @author lake
	 * 
	 */	
	public class WinebarServerDataParse
	{
		/**
		 * 读取升级返回数据
		 * @param data
		 * 
		 */		
		public static function readGradeUp(data : ByteArray):Object
		{
			var resObj :Object = new Object();
			resObj.retcode 		= data.readInt();//返回码
			if(resObj.retcode == 0)
			{
				var baseInfo :WineBarInfoVo = AppData.getInstance().winebarManager.wineBarInfoVo;
				baseInfo.level 		= data.readByte();
				baseInfo.coin 			= data.readUnsignedInt();
				baseInfo.needlevel 	= data.readShort();
				baseInfo.exptime 		= data.readInt();
				baseInfo.nextexp 		= data.readShort();
				baseInfo.nexttime 		= data.readUnsignedInt();
				var curtime :Number = AppData.getInstance().time;
				baseInfo.pretime = curtime;
				Alert.showErrorTip("升级成功");
			}
			else
			{
				Alert.showErrorTip(ErrorTips.instance.getCErrorTip(resObj.retcode) + "");
			}
			return resObj;
		}
	}
}